/**
 * @file Features.h
 * @author enemy1205 (enemy1205@qq.com)
 * @brief 特征基类头文件
 * @date 2021-10-02
 *
 */
#pragma once

#include <opencv2/core/core.hpp>

class Features;

using Features_ptr = std::shared_ptr<Features>;

class Features {
public:
    Features();

    //返回高度
    inline float getHeight() const { return this->height; }

    //返回宽度
    inline float getWidth() const { return this->width; }

    //返回中心坐标
    inline auto getCenter() { return this->center; }

    //返回角度
    inline float getAngle() const { return this->angle; }

    //返回角点地址
    inline cv::Point2f *getVertexes() { return vertexes; }

    //宽高比，装甲板
    inline float wh_ratio() const { return width / height; }

    //高宽比，灯条
    inline float hw_ratio() const { return height / width; }

    // 设置序列匹配信息
    inline void setMatchMessage(bool _match) { this->isMatched = _match; }

    // 获取序列匹配信息
    inline bool getMatchMessage() const { return isMatched; }

    //返回有效性
    inline bool isValid() const { return validity; }

    //返回相对角
    inline cv::Point2f getRelativeAngles() const { return relative_angles; }

    //返回匹配误差
    inline float getMatchError() { return this->match_error; }

    //更新余下信息
    virtual void updateRestInfo() {}

    virtual Features_ptr getSon1_Features() = 0;

    virtual Features_ptr getSon2_Features() = 0;

protected:
    float angle;        //神符为旋转角度，其余均为矩形水平角
    float width;
    float height;
    bool isMatched;
    bool validity;      //有效性
    float match_error;  //匹配误差
    cv::Point2f center; //神符为旋转中心，其余均为矩形中心
    cv::Point2f vertexes[4];
    cv::Point2f relative_angles;//相机中心相对于装甲板中心的角度
};

